<!DOCTYPE html>
<html>
<head>
<title>代码生成器</title>
<#include "/header.html">
</head>
<body>
<div id="rrapp">
	<div class="grid-btn">
		<div>
			<input type="text" v-model="q.bookName" @keyup.enter="query" placeholder="书籍名称">
			<input type="text" v-model="q.rfidCode" @keyup.enter="query" placeholder="RFID编号"><br/>
			<input type="date" v-model="q.bookBorrowStartTimeA" @keyup.enter="query">
			<input type="date" v-model="q.bookBorrowStartTimeB" @keyup.enter="query">书籍借阅开始时间<br/>
			<input type="date" v-model="q.bookBorrowEndTimeA" @keyup.enter="query">
			<input type="date" v-model="q.bookBorrowEndTimeB" @keyup.enter="query">书籍借阅结束时间
			<a class="btn btn-default" @click="query">查询</a>
		</div>
	</div>
    <table id="jqGrid"></table>
    <div id="jqGridPager"></div>
</div>

<script src="${request.contextPath}/statics/js/modules/operation/book-borrow.js?_${.now?long}"></script>
<script type="text/javascript">
	function update(rfidCode){
		layer.open({
		    type: 1
		    ,title: "编辑状态" //不显示标题栏   title : false/标题
		    ,closeBtn: true
		    ,area: '300px;'
		    ,shade: 0.8
		    ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
		    ,resize: false
		    ,btn: ['已出借', '未出借']
		    ,btnAlign: 'c'
		    ,moveType: 1 //拖拽模式，0或者1
		    ,content: ''
		    ,btn1:function(index,layero){
		    	var jsonData = {"rfidCode":rfidCode,"borrowedStatus":2};
		    	updateMethod(jsonData);
		       	layer.close(layer.index);
		    },btn2:function(index,layero){
		    	var jsonData = {"rfidCode":rfidCode,"borrowedStatus":0};
		    	updateMethod(jsonData);
		    	layer.close(layer.index);
		    },cancel: function(){ 
			    //右上角关闭回调
			        
			    //return false 开启该代码可禁止点击该按钮关闭
			}
		});
	}
	function bookBorrowUpdateHtml(rfidCode){
		vm.bookBorrowLayer(rfidCode);
	}
	function bookBorrowCountHtml(rfidCode){
		//console.log(rfidCode);
		//alert(rfidCode);
		vm.bookBorrowCount(rfidCode);
	}
	function bookShelfMonitoringHtml(rfidCode){
		//console.log("ddd");
		vm.bookShelfMonitoringLayer(rfidCode);
	}
	function updateMethod(data){
		$.ajax({
			url : baseURL + 'operation/book/update',
			type : 'POST',
			contentType: "application/json; charset=utf-8",
			data: JSON.stringify(data),
			dataType : 'json',
			success : function(result) {
				if(result.detail!=null){
					layer.msg(result.detail.message, {icon: 1});
				}else{
					layer.msg('修改成功', {icon: 1});
				}
			}
		});
	}
</script>
</body>
</html>